package com.mspbots.rule.dto;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @author Harry hou
 * @date 2019/11/8 11:31
 */
@Data
public class TenantTimeEntryDroolsDTO implements Serializable {

    private Long id;

    private Long tenantId;

    private String tenantName;

    private Long cwUid;

    private Long cwTid;

    private LocalDateTime beginDate;

    private LocalDateTime endDate;

    private LocalDateTime enteredDate;

    private LocalDateTime enteredDateStart;

    private LocalDateTime enteredDateEnd;

    private Double actualHours;

    private String description;

    private JsonNode extend;

    private Long tenantUserId;

    private String ruleScript;

    public TenantTimeEntryDroolsDTO() {
    }

    private TenantTimeEntryDroolsDTO(Long tenantId,
                                     Long tenantUserId,
                                     Long cwTid,
                                     LocalDateTime beginDate,
                                     LocalDateTime endDate,
                                     Double actualHours,
                                     String description,
                                     ObjectNode extend) {
        this.tenantId = tenantId;
        this.cwUid = tenantUserId;
        this.cwTid = cwTid;
        this.beginDate = beginDate;
        this.endDate = endDate;
        this.actualHours = actualHours;
        this.description = description;
        this.extend = extend;
    }

    public static TenantTimeEntryDroolsDTO of(Long tenantId, Long tenantUserId, Long cwTid,
                                              LocalDateTime beginDate, LocalDateTime endDate,
                                              double actualHours, String description, ObjectNode extend) {
        return new TenantTimeEntryDroolsDTO(tenantId, tenantUserId, cwTid, beginDate, endDate, actualHours, description, extend);
    }

}

